package main

import "fmt"

func grade(score int)  string{
	g := ""
	switch  {
	case score < 60:
		g ="C"
	case score < 80:
		g = "B"
	case score <=100:
		g = "A"
		default:
			panic(fmt.Sprintf(
				"出错了 %d",score))
	}
	return g
}

func eval(a,b int,op string) int {
	var result int
	switch op {
	case "+":
		result = a+b
	case "-":
		result = a-b
	case "*":
		result = a*b
	case "/":
		result = a/b
	default:
		panic("error：" +op)

	}
	return result
}


func main() {
	//fmt.Println(grade(110))
	fmt.Println(eval(10,2,"+"))
}

/**
switch
	switch 会自动break，除非使用 fallthrough
	panic 终止程序运行 报错
	switch 后面可以没有表达式

 */